﻿using LPBToolsLib;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace DexServer
{
    public partial class FRTxLog : Form
    {
        public Recorder_RTxBytes tRTxRecorder { get; private set; }
        //private List<ZLErrorRecord> tRTxInfosList { get; } = new List<ZLErrorRecord>();
        //public ZLErrorRecord tRTxInfos { get; private set; } = null;
        public FRTxLog(Recorder_RTxBytes tDestRTxRecorder)
        {
            InitializeComponent();
            tRTxRecorder = tDestRTxRecorder;
        }

        private void tDeamon_Tick(object sender, EventArgs e)
        {
            if (tRTxRecorder.RecCount > 0)
            {
                Record_Byte tRecord = tRTxRecorder.getRecord();
                while (tRecord!=null)
                {
                    richTextBoxRTx.AppendText(tRecord.toLogStr() + "\r\n");
                    tRecord = tRTxRecorder.getRecord();
                }
            }
            if (checkBoxAuto.Checked)
                RichTextGoBottom.GoBottom(richTextBoxRTx);
        }

        private void buttonClear_Click(object sender, EventArgs e)
        {
            richTextBoxRTx.Clear();
        }
    }
}
